#ifndef ModuleManager_h__
#define ModuleManager_h__

#include <boost/thread/recursive_mutex.hpp>
#include <vector>

class IServerObject;

typedef void* (*fn_LoadModule)(const char * pszModuleName, IServerObject * pServerObj);
typedef void  (*fn_UnloadModule)(void* pHandle);

class ModuleManager
{
	
public:
	ModuleManager();
	~ModuleManager();

public:	
	void	UnloadAllModules();
	bool	LoadModule(const char * pszModuleName, const char * pszModulePath, IServerObject * pServerObj);
	void	UnloadModule(const char * pszModuleName);

private:
	struct ModuleInfo
	{
		void*		pModuleInstance;
		char		szModuleName[32];
		void*		pModuleHandle;
	};

	std::vector<ModuleInfo> m_mudules;
	boost::recursive_mutex	m_lock;
};

#endif // ServerModule_h__
